<#include "/layout/layout.ftl"/>
<@body>
<link href="https://cdn.bootcss.com/bootstrap-table/1.14.2/bootstrap-table.min.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/bootstrap-table/1.14.2/bootstrap-table.min.js"></script>
<#--<script src="/script/tool/interface.js"></script>-->
<script src="/script/tool/bootstrapTableUtil.js"></script>
<script src="/script/testcase/testcase.js"></script>
<script src="/script/tool/runTestUtil.js"></script>
<div class="panel-body" style="padding-bottom:0px;">
    <div class="panel panel-default" >
        <div class="panel-heading">查询条件</div>
        <div class="panel-body" style="padding:2px">
            <form id="formSearch" class="form-horizontal">
                <div class="" style="margin-top:15px">
                    <div class="" style="margin-top:15px">
                        <label class="control-label col-sm-1" for="projectName">组件类型</label>
                        <div class="col-md-3">
                            <select id="interfaceType" class="form-control">
                                <option value="${interfaceType!}">${interfaceType!}</option>
                            </select>
                        </div>
                        <label class="control-label col-sm-1" for="interfaceAliasName">用例名称</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" id="interfaceAliasName">
                        </div>
                        <div class="col-sm-4" style="text-align:left;">
                            <button type="button" style="margin-left:50px" id="btn_query" class="btn btn-primary btnFont"
                                    onclick="">
                                查询
                            </button>
                        </div>
                    </div>
            </form>
        </div>
    </div>
    <div id="toolbar">
        <button id="btn_add" type="button" class="btn btn-default" onclick="addTestCasePage()">
            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
        </button>
        <button id="btn_edit" type="button" class="btn btn-default" onclick="modifyTestCase()">
            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>修改
        </button>
        <button id="btn_delete" type="button" class="btn btn-default" onclick="deleteTestCase()">
            <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除
        </button>
        <button type="button" class="btn btn-default" onclick="run()" >
            <span class="glyphicon glyphicon-play" aria-hidden="true"></span>执行用例测试
        </button>
    </div>
    <table id="dataTable"></table>
    <input type="hidden" id="interfaceId" value="${interfaceId!}">
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        新增修改项目
                    </h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-md-3">
                            项目名称:
                        </label>
                        <div class="col-md-9">
                            <input type="hidden" class="form-control" id="id"/>
                            <input class="form-control" id="projectNameDo"/>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                    <button type="button" class="btn btn-primary" onclick="submitProject()">
                        提交更改
                    </button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
</div>
<script>
    $(function () {
        var tableObj ={};
        tableObj.url="/testCase/testCaseList";
        var columns =[];
        columns.push({checkbox:true});
        columns.push({"title":"用例名称","field":"testCaseName"});
        columns.push({"title":"用例级别","field":"level"});
        columns.push({"title":"入参","field":"param"});
        columns.push({"title":"预期结果","field":"expectResult"});
        tableObj.columns=columns;
        initTable($("#dataTable"),tableObj)
    });
    function param(params) {
        var interfaceId=$("#interfaceId").val();
        var temp = {
            interfaceId:interfaceId,
            pageSize: params.limit,
            pageNum: (params.offset / params.limit) + 1 //需要计算页数固定写法
        };
        return temp;
    }

</script>
</@body>